home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / fortran / fort_fmt.zip / FMT.DOC < prev    next >
Text File  |  1992-07-13  |  12KB  |  372 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                                       FMT
  9.                       Automatic FORTRAN FORMAT Statements
  10.                                  Version 1.70
  11.                                    (c) 1990
  12.  
  13.                          "One of many STATOOLS(tm)..."
  14.                                       by
  15.  
  16.                                Gerard E. Dallal
  17.                               54 High Plain Road
  18.                               Andover, MA  01810
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.                                     NOTICE
  34.  
  35.             Copyright 1990 by Gerard E. Dallal.  FMT is shareware.  If
  36.         you find FMT to be useful,  a non-exclusive license fee of  $7
  37.         should be sent to the author.
  38.  
  39.  
  40.  
  41.                                   DISCLAIMER
  42.  
  43.             STATOOLS  are  provided  "as  is"  without warranty of any
  44.         kind.  The entire risk as to  the  quality,  performance,  and
  45.         fitness   for  intended  purpose  is  with  you.   You  assume
  46.         responsibility for the selection of the program  and  for  the
  47.         use of results obtained from that program.
  48.  
  49.  
  50.  
  51.                                                                 PAGE 2
  52.  
  53.                               PROGRAM DESCRIPTION
  54.  
  55.             FMT takes  the  drudgery  out of  writing  FORTRAN  FORMAT
  56.         statements.  Simply  use a  word processor or  text editor  to
  57.         create an ASCII  file that  looks just like  the output  you'd
  58.         like your program to produce.  FMT turns the model into a  set
  59.         of FORMAT  statements that  can be  pasted into  your  FORTRAN
  60.         program.  For example, FMT turns
  61.  
  62.                                 Monthly Report
  63.                                      Wages
  64.  
  65.                  Employee Name           Salary +  Fringe   =  Total
  66.                Last        First
  67.  
  68.           {           }  {       }      ^^^^.^^    ^^^^.^^    ^^^^.^^
  69.  
  70.         into
  71.  
  72.           *   33X,'Monthly Report'/
  73.           *   38X,'Wages'/
  74.           *   /
  75.           *   18X,'Employee Name',11X,'Salary +  Fringe   =  Total'/
  76.           *   16X,'Last',8X,'First'/
  77.           *   /
  78.           *   11X,A13,'  ',A9,6X,F7.2,4X,F7.2,4X,F7.2/
  79.  
  80.  
  81.  
  82.                                    OPERATION
  83.  
  84.             The input to FMT  is an ASCII  file containing the  output
  85.         that is to be transformed into FORTRAN FORMAT statements.  The
  86.         file should look just the way it is to appear on screen.   FMT
  87.         automatically adds a leading blank to each line.
  88.  
  89.             The name of  the input  file must have  the qualifier  UNF
  90.         (for "UNFormatted").  The resulting FORMAT statements will  be
  91.         written to a file with the same basename and the qualifier FMT
  92.         (for "ForMaTted").    For example,  when  DESIGN is  given  in
  93.         response to the FMT prompt
  94.  
  95.                    Enter basename for text to be formatted.
  96.                       (unformatted .UNF, formatted .FMT)
  97.                                 >
  98.  
  99.         (or at  the  DOS  prompt,  by  typing  'FMT basename'  without
  100.  
  101.         FMT                                                G.E. Dallal
  102.  
  103.  
  104.  
  105.                                                                 PAGE 3
  106.  
  107.         quotes)  the  statements  in  the  text  file  DESIGN.UNF  are
  108.         transformed into FORMAT statements in the file DESIGN.FMT.
  109.  
  110.             If the basename is prefixed  by a hyphen (e.g.,  -DESIGN),
  111.         no leading blank is added to each line.
  112.  
  113.             If  the  basename  is  prefixed  by  a  left   parenthesis
  114.         (e.g., )DESIGN), a separate  FORMAT statement  is created  for
  115.         each line in  the UNF  file.  Each  statment in  the FMT  file
  116.         begins with 'FORMAT(' and ends with ')'.
  117.  
  118.         Numerical data
  119.  
  120.             Digits are represented by carets.  Floating point  numbers
  121.         are  distinguished  by  the presence of a decimal point in the
  122.         string.
  123.  
  124.                             ^^^^   becomes I4
  125.                            ^^^^.   becomes F5.0
  126.                          ^^^.^^^   becomes F7.3
  127.  
  128.         Numerical fields  cannot  run  into  each  other.  FMT  cannot
  129.         distinguish between 2I2 and I4.
  130.  
  131.         Character data
  132.  
  133.             The tilde (~) represents a  CHARACTER*1 variable (A1).   A
  134.         string of 'n' tildes becomes nA1  in the FMT file.  The  first
  135.         and last characters of  character variables of length  greater
  136.         than 1 are denoted by the left brace ({) and right brace  (}),
  137.         respectively.
  138.  
  139.                       ~~~~~~~~~~~~  becomes  12A1
  140.                       {          }  becomes  A12
  141.                       {   }~~~{  }  becomes  A5,3A1,A4
  142.  
  143.         Lines beginning with a period (.)
  144.  
  145.             Lines in the UNF file that  have a period (.) in column  1
  146.         receive special  treatment.    They appear  in  the  FMT  file
  147.         unchanged, except for having the initial period dropped.  That
  148.         is, columns 2 through 80 of these lines are printed in columns
  149.         1 to 79 of  the FMT file.   A line in the  UNF file WITHOUT  a
  150.         period in column 1 immediately preceding a line WITH a  period
  151.         in column 1 ends with a  left parenthesis rather than a  slash
  152.         in the FMT file.
  153.  
  154.  
  155.         FMT                                                G.E. Dallal
  156.  
  157.  
  158.  
  159.                                                                 PAGE 4
  160.  
  161.             This feature allows subroutines  that contain many  FORMAT
  162.         statements to be kept in UNF files for easy maintenance.   For
  163.         example, when
  164.  
  165. .      SUBROUTINE OUTPUT(IOUT)
  166. .      WRITE (IOUT, 10)
  167. .   10 FORMAT (
  168.         This  example  illustrates  FMT's handling of lines  beginning
  169.         with a period.  Entire programs and subroutines may be kept in
  170.         UNF format for easy maintenance.
  171. .      RETURN
  172. .      END
  173.  
  174.         is processed by FMT, it becomes
  175.  
  176.       SUBROUTINE OUTPUT(IOUT)
  177.       WRITE (IOUT, 10)
  178.    10 FORMAT (
  179.      *   9X,'This  example  illustrates  FMT''s handling of lines  beg',
  180.      *   'inning'/
  181.      *   9X,'with a period.  Entire programs and subroutines may be ke',
  182.      *   'pt in'/
  183.      *   9X,'UNF format for easy maintenance.')
  184.       RETURN
  185.       END
  186.  
  187.  
  188.  
  189.                                      NOTES
  190.  
  191.             1.  The qualifier  UNF is  not added  to the  basename  in
  192.                 response to the FMT prompt.
  193.  
  194.             2.  Blank lines in the UNF file become slashes (/) in  the
  195.                 FMT file.
  196.  
  197.             3.  The  last  line  in  the  UNF  file  ends  in  a  left
  198.                 parenthesis in the FMT file.
  199.  
  200.             4.  Lines that end in $$ in the UNF file end in '$) in the
  201.                 FMT file.
  202.  
  203.             5.  Carets (^),  tildes (~),  and braces  ({,}) cannot  be
  204.                 used as text in the UNF file.  If these characters are
  205.                 needed, use a surrogate in the UNF file and use a text
  206.                 editor to replace  them after  the FMT  file has  been
  207.                 created.
  208.  
  209.         FMT                                                G.E. Dallal
  210.  
  211.  
  212.  
  213.                                                                 PAGE 5
  214.  
  215.             6.  Unbalanced braces will cause the program to  terminate
  216.                 with an error message.
  217.  
  218.             7.  Single quotes may appear in  the UNF file.  They  will
  219.                 be doubled appropriately in the FMT file.
  220.  
  221.  
  222.                                 UPDATE HISTORY
  223.  
  224.             1.01 -- Lines ending in Fw.0 no longer have ,'' before the
  225.                         final slash.   The  extra characters  did  not
  226.                         affect the behavior  of the FORMAT  statement;
  227.                         they merely looked unsightly.
  228.  
  229.             1.10 -- Internal enhancements not affecting output.
  230.  
  231.             1.20 -- Long character  strings with  embedded commas  now
  232.                         split properly.
  233.                     ASCII  250  and  255  (PC-Write's  hard  and  soft
  234.                         spaces) automatically translated to spaces.
  235.  
  236.             1.30 -- Long formats now  split prope